package com.zl.smartmall.library.po;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * 商城活动(首)页主题市场
 * 
 * @author 陈希然
 * 
 */
public class ActivitiesThemeMarketInfo extends BaseActivitiesInfo  {
	
	private int activitiesId;
	private int productId;
	private int width;
	private int height;
	private String intro;
	private String name;
	private String picture;
	private CountDownInfo countDownInfo;

	public int getActivitiesId() {
		return activitiesId;
	}

	public void setActivitiesId(int activitiesId) {
		this.activitiesId = activitiesId;
	}

	public int getProductId() {
		return productId;
	}

	public void setProductId(int productId) {
		this.productId = productId;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public String getIntro() {
		return intro;
	}

	public void setIntro(String intro) {
		this.intro = intro;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	public CountDownInfo getCountDownInfo() {
		return countDownInfo;
	}

	public void setCountDownInfo(CountDownInfo countDownInfo) {
		this.countDownInfo = countDownInfo;
	}

	public static List<ActivitiesThemeMarketInfo> parse(JSONArray jsonArray) throws JSONException {
		List<ActivitiesThemeMarketInfo> activitiesThemeMarketInfos = new ArrayList<ActivitiesThemeMarketInfo>();
		for(int i = 0; jsonArray != null && i < jsonArray.length(); i++) {
			JSONObject jsonObject =  jsonArray.getJSONObject(i);
			if(jsonObject != null && jsonObject.length() > 0) {
				ActivitiesThemeMarketInfo activitiesThemeMarketInfo = new ActivitiesThemeMarketInfo();
				activitiesThemeMarketInfo.activitiesId = jsonObject.getInt("act_id");
				activitiesThemeMarketInfo.height = jsonObject.getInt("height");
				activitiesThemeMarketInfo.intro = jsonObject.getString("intro");
				activitiesThemeMarketInfo.name = jsonObject.getString("name");
				activitiesThemeMarketInfo.picture = jsonObject.getString("pic");
				activitiesThemeMarketInfo.productId = jsonObject.getInt("product_id");
				activitiesThemeMarketInfo.width = jsonObject.getInt("width");
				activitiesThemeMarketInfo.countDownInfo = CountDownInfo.parse(jsonObject.getJSONObject("countdown"));
				activitiesThemeMarketInfo.activitiesInfoType = ActivitiesInfoType.TYPE_THEME_MARKET;
				activitiesThemeMarketInfos.add(activitiesThemeMarketInfo);
			}
		}
		
		return activitiesThemeMarketInfos;
	}
}
